/************************************************************************/
/* Game                                                                 */
/************************************************************************/
#include "Game/Game Objects/Towers/MagikoopaTower.h"

namespace TD_Game {


	/************************************************************************/
	/* Flower tower definitions                                             */
	/************************************************************************/

	const int MagikoopaTower::shootingInterval[NUMBER_OF_LEVELS] =				{1800, 1700, 1700, 1500, 1250, 1250};
	const unsigned int MagikoopaTower::towerRadius[NUMBER_OF_LEVELS] =			{300, 375, 425, 500, 550, 600};
	const unsigned int MagikoopaTower::towerDamage[NUMBER_OF_LEVELS] =			{45, 65, 95, 120, 160, 200};
	const unsigned int MagikoopaTower::towerPrice[NUMBER_OF_LEVELS] =			{30, 65, 102, 140, 190, 230};
	const unsigned int MagikoopaTower::towerValue[NUMBER_OF_LEVELS] =			{35, 75, 175, 220};
	const string MagikoopaTower::towerName = "Torre Magikoopa";

	
	const MagikoopaTower *MagikoopaTower::m_pStaticReference = NULL;
	shared_ptr<SDLSound> MagikoopaTower::m_pHittedSound = shared_ptr<SDLSound>();
	shared_ptr<SDLSound> MagikoopaTower::m_pLaunchSound = shared_ptr<SDLSound>();


	/************************************************************************/
	/* Protected functions                                                  */
	/************************************************************************/
	void MagikoopaTower::initBaseValues() {
		for(unsigned int i = 0; i < NUMBER_OF_LEVELS; i++) {
			m_shootingInterval[i] = shootingInterval[i];
			m_towerDamage[i] = towerDamage[i];
			m_towerRange[i] = towerRadius[i];
			m_towerPrice[i] = towerPrice[i];
			m_towerValue[i] = towerValue[i];
		}
		m_towerName = towerName;

		m_pDescriptionTile = new Tile(Coord2D(0.81191*screenWidth, 0.375*screenHeight), Coord2D(184, 74), 
			imgTile, TD_Resources::ResourceManager::loadImage("GUI/Descriptions/magikoopaTowerDescription.png", Color::PINK));
		m_baseTowerType = magikoopaTower_lvl1;
		m_baseShotType = magikoopaShot_lvl1;
		//Upgrade bar displacement
		m_upBarDisplacement = Coord2D(-15, 25);
	}

	/************************************************************************/
	/* ctors and dtors                                                      */
	/************************************************************************/

	MagikoopaTower::MagikoopaTower() {
		initBaseValues();
	}

	MagikoopaTower::MagikoopaTower(const MagikoopaTower & rhs) {

	}

	MagikoopaTower & MagikoopaTower::operator=(const MagikoopaTower &rhs) {
		BaseTower::operator=(rhs);
		return(*this);
	}

	MagikoopaTower::MagikoopaTower(unsigned int g_ID, const Coord2D & turretPosition) : BaseTower (g_ID, turretPosition) {

		initBaseValues();

		m_pAnimationSet = AnimationSetFactory::createTowerAnimationSet(m_baseTowerType, "Idle");
		m_pBaseShotAS = AnimationSetFactory::createShotAnimationSet(m_baseShotType, "Moving");

		m_shapes.push_back(new RectangleShape(turretPosition - m_pAnimationSet->getSprites()->getTilesize()/2, m_pAnimationSet->getSprites()->getTilesize()));
	}
	MagikoopaTower::~MagikoopaTower() {

	}
}